#ifndef _PAGESETTING_H_
#define _PAGESETTING_H_

#include <QList>
#include <QVariantMap>
#include <QVariant>

#define SPIDER_NAME "spider webkit core"

#define PAGE_SETTINGS_LOAD_IMAGES           "loadImages"
#define PAGE_SETTINGS_JS_ENABLED            "javascriptEnabled"
#define PAGE_SETTINGS_XSS_AUDITING          "XSSAuditingEnabled"
#define PAGE_SETTINGS_USER_AGENT            "userAgent"
#define PAGE_SETTINGS_LOCAL_ACCESS_REMOTE   "localToRemoteUrlAccessEnabled"
#define PAGE_SETTINGS_USERNAME              "userName"
#define PAGE_SETTINGS_PASSWORD              "password"
#define PAGE_SETTINGS_MAX_AUTH_ATTEMPTS     "maxAuthAttempts"
#define PAGE_SETTINGS_RESOURCE_TIMEOUT      "resourceTimeout"
#define PAGE_SETTINGS_WEB_SECURITY_ENABLED  "webSecurityEnabled"
#define PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS   "javascriptCanOpenWindows"
#define PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS  "javascriptCanCloseWindows"

namespace Setting {
    class PageSetting {
        public:
            PageSetting() {
                // TODO: add config set code, and read those value from config.
                m_pageSettings[PAGE_SETTINGS_LOAD_IMAGES] = QVariant::fromValue(false); //m_config.autoLoadImages()
                m_pageSettings[PAGE_SETTINGS_JS_ENABLED] = QVariant::fromValue(true);
                m_pageSettings[PAGE_SETTINGS_XSS_AUDITING] = QVariant::fromValue(false);
                m_pageSettings[PAGE_SETTINGS_USER_AGENT] = QVariant::fromValue(QString("Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0")); //m_page->userAgent()
                m_pageSettings[PAGE_SETTINGS_LOCAL_ACCESS_REMOTE] = QVariant::fromValue(true); //m_config.localToRemoteUrlAccessEnabled()
                m_pageSettings[PAGE_SETTINGS_WEB_SECURITY_ENABLED] = QVariant::fromValue(false); //m_config.webSecurityEnabled()
                m_pageSettings[PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS] = QVariant::fromValue(false); //m_config.javascriptCanOpenWindows()
                m_pageSettings[PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS] = QVariant::fromValue(false); //m_config.javascriptCanCloseWindows()
                m_pageSettings[PAGE_SETTINGS_RESOURCE_TIMEOUT] = QVariant::fromValue(30000);
            }

            void set(char* name, QVariant value) {
                if (!name)
                    return ;
                m_pageSettings[name] = value;
            }

            QVariantMap& setting() {
                return m_pageSettings;
            }

        private:
            QVariantMap m_pageSettings;
    };

    class NetSetting {
        public:
            NetSetting() {
            }
    };
} //namespace Setting

#endif

